wayland: Ensure modal hint gets set on map
authorRui Matos <tiagomatos@gmail.com>
Sat, 1 Aug 2015 15:03:49 +0000 (17:03 +0200)
committerRui Matos <tiagomatos@gmail.com>
Mon, 3 Aug 2015 12:24:38 +0000 (14:24 +0200)
We need to be mapped to have a gtk_surface and thus be able to do
requests on it so we need to save the modal hint and apply it when we
get mapped so that code that sets the hint before showing a window
doesn't get ignored.

https://bugzilla.gnome.org/show_bug.cgi?id=753138

gdk/wayland/gdkwindow-wayland.c

index fd02480ed080e110e76686accde3f09e0c8af872..c700a560bb7fd2b94aef9bfb6edc7d0173e8e926 100644 (file)
@@ -159,6 +159,7 @@ static void gdk_wayland_window_configure (GdkWindow *window,
                                           int        scale);
 
 static void maybe_set_gtk_surface_dbus_properties (GdkWindow *window);
+static void maybe_set_gtk_surface_modal (GdkWindow *window);
 
 static void gdk_window_request_transient_parent_commit (GdkWindow *window);
 
@@ -1026,6 +1027,7 @@ gdk_wayland_window_create_xdg_surface (GdkWindow *window)
   xdg_surface_set_app_id (impl->xdg_surface, app_id);
 
   maybe_set_gtk_surface_dbus_properties (window);
+  maybe_set_gtk_surface_modal (window);
 }
 
 static void
@@ -1699,8 +1701,7 @@ gdk_wayland_window_init_gtk_surface (GdkWindow *window)
 }
 
 static void
-gdk_wayland_window_set_modal_hint (GdkWindow *window,
-                                   gboolean   modal)
+maybe_set_gtk_surface_modal (GdkWindow *window)
 {
   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
 
@@ -1708,10 +1709,19 @@ gdk_wayland_window_set_modal_hint (GdkWindow *window,
   if (impl->gtk_surface == NULL)
     return;
 
-  if (modal)
+  if (window->modal_hint)
     gtk_surface_set_modal (impl->gtk_surface);
   else
     gtk_surface_unset_modal (impl->gtk_surface);
+
+}
+
+static void
+gdk_wayland_window_set_modal_hint (GdkWindow *window,
+                                   gboolean   modal)
+{
+  window->modal_hint = modal;
+  maybe_set_gtk_surface_modal (window);
 }
 
 static void